var COMMON = {
    url: 'http://dan365.dans.top/dans/',
}

var URL = window.location.host;
var PORT = window.location.port;
if (PORT) {
    URL += ":" + PORT + "/";
}
var msg = "数据加载中";
var page = 1;

function c_getJSON(url, json, data) {
    console.log(URL);
    var url_ = '';
    if (json) {
        for(var p in json){//遍历json数组时，这么写p为索引，0,1
            console.log(packJson[p].name + " " + packJson[p].password);
        }
    }
    if(hui.refreshNumber < 1){
        hui.loading(msg);
    }
    //设置定时关闭loading
//    setTimeout(function(){hui.loading(false, true);}, 2000);
    hui.getJSON(
        url,
        function(m){
            data.info = m.data;
            hui.endRefresh();
            hui.loading(msg, true);
        },
        function(){
            hui.loading(msg, true);
            hui.toast('连接服务器失败！');
            hui.endRefresh();
        }
    );
    hui.lazyLoad();
}

function c_getMore(url, json, data) {
    console.log(URL);
    var url_ = '';
    if (json) {
        for(var p in json){//遍历json数组时，这么写p为索引，0,1
            console.log(packJson[p].name + " " + packJson[p].password);
        }
    }
    hui.getJSON(
        url,
        function(m){
            //判断加载完毕
            if(!m.data){
                hui.endLoadMore(true, '已经到头了...');
                return false;
            }
            page++;
            data.info = data.info.concat(m.data);
            hui.endLoadMore();
        }
    );
    hui.lazyLoad();
}